home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume11 / mush5.7 / part01 next >
Encoding:
Internet Message Format  |  1987-09-16  |  56.8 KB

  1. Subject:  v11i051:  Mail user's shell, Part01/12
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rs@uunet.UU.NET
  5.  
  6. Submitted-by: island!argv@Sun.COM (Dan Heller)
  7. Posting-number: Volume 11, Issue 51
  8. Archive-name: mush5.7/Part01
  9.  
  10. [  It was only a matter of time.  This is a complete shell, similar
  11.    in many ways to the C shell.  It's a mail program.  It's a SunTools
  12.    program.  It's a Curses porgram.  It's a way of life.  See the
  13.    README.  This is a biggie, and the weekend will cause a lag in the
  14.    postings.  --r$  ]
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 1 (of 12)."
  23. # Contents:  MANIFEST README bindings.h check.pr coffee.cup.pr
  24. #   config.h-dist cycle.pr dn.arrow.pr edit_menu.c envelope.pr expr.c
  25. #   glasses.pr hdr_panel.c hdr_procs.c mail.icon.1 mail.icon.2
  26. #   makefile.bsd makefile.sun makefile.sys.v print.c strings.h tool.c
  27. #   up.arrow.pr write.pr
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  31. else
  32. echo shar: Extracting \"'MANIFEST'\" \(1807 characters\)
  33. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  34. X   File Name        Archive #    Description
  35. X-----------------------------------------------------------
  36. X MANIFEST                  1    This shipping list
  37. X README                    1    
  38. X aliases.c                 2    
  39. X bind.c                    4    
  40. X bindings.h                1    
  41. X check.pr                  1    
  42. X cmd_help                  5    
  43. X coffee.cup.pr             1    
  44. X commands.c                7    
  45. X config.h-dist             1    
  46. X curs_io.c                 2    
  47. X curses.c                  6    
  48. X cycle.pr                  1    
  49. X dates.c                   2    
  50. X dn.arrow.pr               1    
  51. X doproc.c                  4    
  52. X edit_menu.c               1    
  53. X envelope.pr               1    
  54. X execute.c                 2    
  55. X expr.c                    1    
  56. X fkeys.c                   5    
  57. X folders.c                 2    
  58. X glasses.pr                1    
  59. X hdr_panel.c               1    
  60. X hdr_procs.c               1    
  61. X hdrs.c                    8    
  62. X help.c                    3    
  63. X init.c                    4    
  64. X loop.c                    9    
  65. X mail.c                   10    
  66. X mail.icon.1               1    
  67. X mail.icon.2               1    
  68. X main.c                    3    
  69. X main_panel.c              2    
  70. X makefile.bsd              1    
  71. X makefile.sun              1    
  72. X makefile.sys.v            1    
  73. X misc.c                    7    
  74. X msgs.c                    6    
  75. X mush.1.a                 11    FIRST HALF OF MANPAGE
  76. X mush.1.b                 12    SECOND HALF OF MANPAGE
  77. X mush.h                    6    
  78. X pick.c                    3    
  79. X print.c                   1    
  80. X rite.c                    2    
  81. X select.c                  5    
  82. X setopts.c                 3    
  83. X signals.c                 3    
  84. X sort.c                    2    
  85. X strings.h                 1    
  86. X tool.c                    1    
  87. X tool_help                 8    
  88. X up.arrow.pr               1    
  89. X viewopts.c                4    
  90. X write.pr                  1    
  91. END_OF_FILE
  92. if test 1807 -ne `wc -c <'MANIFEST'`; then
  93.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  94. fi
  95. # end of 'MANIFEST'
  96. fi
  97. if test -f 'README' -a "${1}" != "-c" ; then 
  98.   echo shar: Will not clobber existing file \"'README'\"
  99. else
  100. echo shar: Extracting \"'README'\" \(8085 characters\)
  101. sed "s/^X//" >'README' <<'END_OF_FILE'
  102. X/* @(#)README    2.4    (c) copyright 10/28/86    (Dan Heller) */
  103. X
  104. XAuthor:
  105. X    Dan Heller
  106. X
  107. XNetwork address:
  108. X    island!argv@sun.com   or   argv@spam.istc.sri.com
  109. X
  110. XContained is the source for "Mail User's Shell" (MUSH), an interface
  111. Xfor the sending, viewing and managing of electronic mail on UNIX(tm) systems.
  112. XRedistribution of this code is permitted as long as all copyright notices
  113. Xremain intact and all other identifying notices remain in the code and
  114. Xin the binary.  This includes message headers on outgoing mail and
  115. Xthe startup message.  Failing to adhere to this reflects on your poor
  116. Xsense of fair play and bad attitude -- you will probably fail in your
  117. Xsocial and business affairs with little honor and respect from your peers.
  118. X
  119. XWith that out of the way...
  120. X
  121. XTo install Mush on your system, find the file that most closely resembles
  122. X"config.h" (probably "config.h-dist") COPY it to config.h, edit it to reflect
  123. Xthe system dependencines described there.  Decide which makefile applies
  124. Xto you.  makefile.sun applies only to suns and creates a binary called
  125. X"mush."  If the binary ends in "tool", then the graphics (tool) mode will
  126. Xbe used by default on invocation. Otherwise, you must specify -t for toolmode
  127. Xon sun workstations.  The SUNTOOL define must be set in the makefile.sun
  128. Xin order to compile the suntools version.  You don't need to be running
  129. Xsunview; old sunwindows (2.0+) may be used.
  130. X
  131. XIf you're on a BSD system and it's not a sun workstation, or if you're on a
  132. Xsun workstation and know that you're not going to use the suntools mode then
  133. Xyou should use makefile.bsd so that SUNTOOL won't be defined and unneccessary
  134. Xfiles not be compiled so the binary will be made smaller.
  135. X
  136. Xmakefile.sys.v is for unix machines that are not running any flavor of
  137. XBSD and probably running a system-v flavor of unix (Xenix, for example).
  138. XThis makefile has the define, SYSV to indicate system V unix.  Some older
  139. Xunix systems have SYSV defined in /usr/include/curses.h (which is used if
  140. Xyou have CURSES defined in the makefile).  In most cases, these only
  141. Xgenerate annoying warning messages and does not effect the compilation
  142. Xof the code.
  143. X
  144. XMush was designed to use sendmail. However, other mail delivery subsystem have
  145. Xworked.  The mail delivery subsystem you use should be defined in config.h
  146. Xunder the MAIL_DELIVERY macro define. By default, /usr/lib/sendmail -i
  147. Xis used -- the option, -i, tells sendmail not to exit on "." on a line
  148. Xby itself.  Mush will pick that up by itself if you want that option
  149. X(read the man page).
  150. X
  151. XIf your mailer does NOT have a verbose option, then you should not have
  152. XVERBOSE_ARG defined.  Otherwise, define it to be whatever the
  153. Xverbose argument is for your mailer.
  154. X
  155. XSendmail uses the -m argument to say, "metoo" -- when sending to mailing
  156. Xlists, normally sendmail will send mail to mailing lists, but if you're
  157. Xin that list, you are excluded from getting your own mail.  However, if
  158. Xyou have the variable metoo set with your variables, then the METOO argument
  159. Xis passed to sendmail to say, "I know I'm on this mailing list, but send
  160. Xme a copy of my message even tho I sent it."  For sendmail, this is -m.
  161. XIf your mailer uses something else, then define METOO_ARG in the config file.
  162. XIf you don't have it (sys-v), then do not define this macro.
  163. X
  164. XIf you use "smail" and you're on a system-v small unix box, you might have
  165. Xto increase your stack size (see makefile.sys.v) to prevent stack overflow.
  166. XYou'll know you have to do this if you try sending mail (using smail as
  167. Xthe mail delivery subsystem), mush core dumps and adb doesn't know where
  168. Xthe stack pointer is.
  169. X
  170. XVPRINTF should be defined if your system has the vprintf functions. You
  171. X*have* these functions if 1) you are running system V (xenix) or 2) you
  172. Xare running a Sun release on or later than version 3.0.  If you are still not
  173. Xsure, try the following command from your shell:
  174. X
  175. X% ar t /lib/libc.a | grep vprintf
  176. X
  177. XIf you have it, you'll probably get something like
  178. Xvprintf.o
  179. Xvsprintf.o
  180. Xas output.  If you don't have it, you won't have any output.  If your
  181. Xmain C-libraries are not in /lib/libc.a, then find where they are and
  182. Xtry the same command using that file.
  183. X
  184. XA default mailrc should be installed for new users.  UCB mail's default
  185. XMailrc works but no mailrc works as well. The location of the default
  186. Xfile should be defined in config.h.  To have no default mailrc, set the
  187. Xdefault to /dev/null.  For sun systems, the default .mailrc (/usr/lib/Mailrc)
  188. Xdoes not work very well because sun's Mail is not standard /usr/ucb/Mail.
  189. XFor this reason, sun has not changed the default mailrc file and still
  190. Xresides in /usr/lib/Mail.rc (note this has the "." whereas the other file
  191. Xdoes not).  The default config.h-dist reflects this.
  192. X
  193. XThe help files should be placed somewhere which is readable and accessible
  194. Xby all. Failing to do so removes virtually the entire help facility's
  195. Xability to help anyone.  There is a help file for command help ( `command -?'),
  196. Xand the other is for the graphics mode (Sun workstations only).  You should
  197. Xdefine where you want these files in "config.h" so at runtime, they can be
  198. Xaccessed without error.
  199. X
  200. XThe default settings in config.h may be documented as the default values
  201. Xin the help files.  Be aware that changing some default values may cause
  202. Xinconsistencies with the help files and documentation.
  203. X
  204. XIf your system has *sys_siglist[], skip this paragraph.  If it doesn't,
  205. Xor if your system has a non-standard list, you should edit signals.c at
  206. Xthe top and build the table manually from the one given for System-V people.
  207. XNote that most system-v unix systems need not change anything as long as
  208. XSYSV is defined.
  209. X
  210. XMaintenance:
  211. X
  212. XIf you want to use dbx or any other debugger, the undocumented flag, -e
  213. Xshould be used as command line argument when you run the binary under
  214. Xthe debugger.  What this flag does is prevents your echo from being
  215. Xturned off and leaving cbreak on, thus, keeping your tty in a sane state.
  216. XBeware of curses mode tho, since it must be turned off for that -- e.g.
  217. Xthe -e flag is overridden if you enter curses mode.  The -e flag can be
  218. Xused in general usage anyway, but there's no difference known to the user
  219. Xexcept for the fact that you can not type control characters.
  220. X
  221. XIf you have memory allocation checking and validation (sun 3.0+ ?) then
  222. Xdefine M_DEBUG in the makefile (main.c) and add the library
  223. X/usr/lib/debug/malloc.o to the library list. Do this only if you are
  224. Xfind bugs in the program and suspect memory allocation errors. main.c
  225. Xhas the code which sets the debugging level according to the value of
  226. Xan environment variable.  Because malloc-debugging is so cpu intensive,
  227. Xthe sunwindows program will get a SIGXCPU (cpu time limit exceeded)
  228. Xbecause of the large amount of opening and closing large pixrects and
  229. Xdevices.  For this reason, SIGXPCPU is is caught in main.c.
  230. X
  231. XIf you ever get "Message N has bad date: <date string>" then note
  232. Xthe FORMAT of that date and edit dates.c.  There are a number of
  233. X"sscanf"s which you can see match known date formats.  Use them as
  234. Xexamples and insert the new date format you have.
  235. X
  236. XIf you ever add new variables, be sure to add them in viewopts.c and the
  237. Xman page.
  238. X
  239. XIf Mush ever coredumps and you are suspicious about whether or not
  240. Xyour folder (or spool directory) was removed.  Or, if you were editing
  241. Xa letter, you should check for the files .mushXXXXXX and .edXXXXXXX.
  242. XMush won't die without telling you that it's dying and it will ask if you
  243. Xwant to save the .mush????? file and if you actually want it to dump core.
  244. XNote that if you run mush from .suntools and there is a core dump, it
  245. Xprobably wants to do some IO with the console and may hang (not exit)
  246. Xbecause it doesn't know it can't talk to you.
  247. X
  248. XLast attempted, mush passed lint with a small number of errors indicating
  249. Xthat fflush, fclose and other similar functions returned values which
  250. Xwere always ignored.  Sorry.  I did not attempt lint on the suntools mode.
  251. XCurses doesn't lint very well, but even when you lint mush with CURSES
  252. Xdefined, it only complains about the unused curses globals in curses.h;
  253. Xdon't let it discourage you.
  254. END_OF_FILE
  255. if test 8085 -ne `wc -c <'README'`; then
  256.     echo shar: \"'README'\" unpacked with wrong size!
  257. fi
  258. # end of 'README'
  259. fi
  260. if test -f 'bindings.h' -a "${1}" != "-c" ; then 
  261.   echo shar: Will not clobber existing file \"'bindings.h'\"
  262. else
  263. echo shar: Extracting \"'bindings.h'\" \(1492 characters\)
  264. sed "s/^X//" >'bindings.h' <<'END_OF_FILE'
  265. X/* bindings.h  -- command bindings */
  266. X
  267. X/* to see if a key sequece matches, prefixes or misses a set binding */
  268. X#define NO_MATCH    0
  269. X#define MATCH        1
  270. X#define A_PREFIX_B    2
  271. X#define B_PREFIX_A    3
  272. X
  273. X#define NULL_MAP    (struct cmd_map *)0
  274. X#define C_NULL        0
  275. X#define C_GOTO_MSG    1
  276. X#define C_WRITE_MSG    2
  277. X#define C_WRITE_LIST    3
  278. X#define C_SAVE_MSG    4
  279. X#define C_SAVE_LIST    5
  280. X#define C_COPY_MSG    6
  281. X#define C_COPY_LIST    7
  282. X#define C_DELETE_MSG    8
  283. X#define C_DELETE_LIST    9
  284. X#define C_UNDEL_MSG    10
  285. X#define C_UNDEL_LIST    11
  286. X#define C_REVERSE    12
  287. X#define C_REDRAW    13
  288. X#define C_NEXT_MSG    14
  289. X#define C_PREV_MSG    15
  290. X#define C_FIRST_MSG    16
  291. X#define C_LAST_MSG    17
  292. X#define C_TOP_PAGE    18
  293. X#define C_BOTTOM_PAGE    19
  294. X#define C_NEXT_SCREEN    20
  295. X#define C_PREV_SCREEN    21
  296. X#define C_SHOW_HDR    22
  297. X#define C_SOURCE    23
  298. X#define C_SAVEOPTS    24
  299. X#define C_NEXT_SEARCH    25
  300. X#define C_PREV_SEARCH    26
  301. X#define C_CONT_SEARCH    27
  302. X#define C_PRESERVE    28
  303. X#define C_SORT        29
  304. X#define C_REV_SORT    30
  305. X#define C_QUIT_HARD    31
  306. X#define C_QUIT        32
  307. X#define C_EXIT_HARD    33
  308. X#define C_EXIT        34
  309. X#define C_UPDATE    35
  310. X#define C_FOLDER    36
  311. X#define C_SHELL_ESC    37
  312. X#define C_CURSES_ESC    38
  313. X#define C_PRINT_MSG    39
  314. X#define C_CHDIR        40
  315. X#define C_VAR_SET    41
  316. X#define C_IGNORE    42
  317. X#define C_ALIAS        43
  318. X#define C_OWN_HDR    44
  319. X#define C_VERSION    45
  320. X#define C_MAIL_FLAGS    46
  321. X#define C_MAIL        47
  322. X#define C_REPLY_SENDER    48
  323. X#define C_REPLY_ALL    49
  324. X#define C_DISPLAY_MSG    50
  325. X#define C_TOP_MSG    51
  326. X#define C_DISPLAY_NEXT    52
  327. X#define C_BIND        53
  328. X#define C_UNBIND    54
  329. X#define C_HELP        55 /* THIS MUST BE THE LAST ITEM */
  330. END_OF_FILE
  331. if test 1492 -ne `wc -c <'bindings.h'`; then
  332.     echo shar: \"'bindings.h'\" unpacked with wrong size!
  333. fi
  334. # end of 'bindings.h'
  335. fi
  336. if test -f 'check.pr' -a "${1}" != "-c" ; then 
  337.   echo shar: Will not clobber existing file \"'check.pr'\"
  338. else
  339. echo shar: Extracting \"'check.pr'\" \(240 characters\)
  340. sed "s/^X//" >'check.pr' <<'END_OF_FILE'
  341. X/* "@(#)check.pr    2.2    9/3/86 (Dan Heller)"; */
  342. X
  343. X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  344. X */
  345. X    0x0000,0x0000,0x0001,0x0003,0x0007,0x000E,0x001C,0x0038,
  346. X    0xC070,0xE0E0,0x71C0,0x3B80,0x1F00,0x0E00,0x0400,0x0000
  347. END_OF_FILE
  348. if test 240 -ne `wc -c <'check.pr'`; then
  349.     echo shar: \"'check.pr'\" unpacked with wrong size!
  350. fi
  351. # end of 'check.pr'
  352. fi
  353. if test -f 'coffee.cup.pr' -a "${1}" != "-c" ; then 
  354.   echo shar: Will not clobber existing file \"'coffee.cup.pr'\"
  355. else
  356. echo shar: Extracting \"'coffee.cup.pr'\" \(193 characters\)
  357. sed "s/^X//" >'coffee.cup.pr' <<'END_OF_FILE'
  358. X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  359. X */
  360. X    0x0200,0x0100,0x0600,0x0800,0x0600,0x0100,0xFFF8,0x800C,
  361. X    0x800A,0x4012,0x401C,0x2020,0x9048,0x7FF0,0x3FE0,0x0000
  362. END_OF_FILE
  363. if test 193 -ne `wc -c <'coffee.cup.pr'`; then
  364.     echo shar: \"'coffee.cup.pr'\" unpacked with wrong size!
  365. fi
  366. # end of 'coffee.cup.pr'
  367. fi
  368. if test -f 'config.h-dist' -a "${1}" != "-c" ; then 
  369.   echo shar: Will not clobber existing file \"'config.h-dist'\"
  370. else
  371. echo shar: Extracting \"'config.h-dist'\" \(1634 characters\)
  372. sed "s/^X//" >'config.h-dist' <<'END_OF_FILE'
  373. X/* config.h 1.1    (c) copyright 1986 (Dan Heller) */
  374. X
  375. X#define MAILRC        ".mushrc"
  376. X#define ALTERNATE_RC    ".mailrc"
  377. X#define LIBDIR        "/usr/lib
  378. X#define DEFAULT_RC    LIBDIR/Mail.rc"
  379. X#define COMMAND_HELP    LIBDIR/cmd_help"
  380. X#ifdef SUNTOOL
  381. X#    define TOOL_HELP    LIBDIR/tool_help"
  382. X#endif SUNTOOL
  383. X#define ALTERNATE_HOME    "/tmp"       /* Path must be read/write to EVERYONE */
  384. X#define EDFILE      ".edXXXXXX"  /* file/pathname added to user's "home" */
  385. X
  386. X/* mail delivery system */
  387. X#define MAIL_DELIVERY    "/usr/lib/sendmail -i"
  388. X#define VERBOSE_ARG    "-v"    /* undef if none exists */
  389. X#define METOO_ARG    "-m"    /* man sendmail for more info. */
  390. X
  391. X#define    MAXMSGS        1000    /* maximum number of messages we can read */
  392. X#ifndef MAXPATHLEN
  393. X#define MAXPATHLEN 256
  394. X#endif
  395. X
  396. X#define VPRINTF        /* If your system supports the vprintf() functions,
  397. X             * True for sys-v and later sun versions (3.0+ ?).
  398. X             */
  399. X
  400. X/* The maximum number of hostnames YOUR host may have (usually found in
  401. X * /etc/hosts for BSD systems).  System-V/xenix doesn't use this (use 1).
  402. X */
  403. X#define MAX_HOST_NAMES  1
  404. X
  405. X#define LS_COMMAND    "ls"
  406. X#define FORTUNE        "/usr/games/fortune"
  407. X#define LPR        "lpr"
  408. X#define SIGNATURE    ".signature"
  409. X#define MAILDIR        "/usr/spool/mail"
  410. X
  411. X/* default settings for some variable strings */
  412. X#define DEF_PROMPT    "Msg %m of %t: "
  413. X#define DEF_PAGER    "more"
  414. X#define DEF_SHELL    "csh"
  415. X#define DEF_EDITOR    "vi"
  416. X#define DEF_FOLDER    "~/Mail"        /* default Mail folder */
  417. X#define DEF_MBOX    "~/mbox"    /* default mbox */
  418. X#define DEF_INDENT_STR    "> "        /* indent included mail */
  419. X#define DEF_PRINTER    "lp"
  420. X#define DEF_ESCAPE    "~"
  421. X#define DEF_HDR_FMT    "%S %25f %7d (%l/%c) %25s" /* headers format string */
  422. END_OF_FILE
  423. if test 1634 -ne `wc -c <'config.h-dist'`; then
  424.     echo shar: \"'config.h-dist'\" unpacked with wrong size!
  425. fi
  426. # end of 'config.h-dist'
  427. fi
  428. if test -f 'cycle.pr' -a "${1}" != "-c" ; then 
  429.   echo shar: Will not clobber existing file \"'cycle.pr'\"
  430. else
  431. echo shar: Extracting \"'cycle.pr'\" \(241 characters\)
  432. sed "s/^X//" >'cycle.pr' <<'END_OF_FILE'
  433. X/* "@(#)cycle.pr    2.2    9/3/86 (Dan Heller)"; */
  434. X
  435. X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  436. X */
  437. X    0x07C0,0x0FE0,0x1834,0x301C,0x601C,0x203C,0x0000,0x0000,
  438. X    0x7808,0x700C,0x7018,0x5830,0x0FE0,0x07C0,0x0000,0x0000
  439. X
  440. END_OF_FILE
  441. if test 241 -ne `wc -c <'cycle.pr'`; then
  442.     echo shar: \"'cycle.pr'\" unpacked with wrong size!
  443. fi
  444. # end of 'cycle.pr'
  445. fi
  446. if test -f 'dn.arrow.pr' -a "${1}" != "-c" ; then 
  447.   echo shar: Will not clobber existing file \"'dn.arrow.pr'\"
  448. else
  449. echo shar: Extracting \"'dn.arrow.pr'\" \(243 characters\)
  450. sed "s/^X//" >'dn.arrow.pr' <<'END_OF_FILE'
  451. X/* "@(#)dn.arrow.pr    2.2    9/3/86 (Dan Heller)"; */
  452. X
  453. X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  454. X */
  455. X    0xFFFF,0x8001,0xBFFD,0xBFFD,0xBFFD,0x9FF9,0x8FF1,0x87E1,
  456. X    0x83C1,0x8181,0xB825,0xA435,0xA42D,0xB825,0x8001,0xFFFF
  457. END_OF_FILE
  458. if test 243 -ne `wc -c <'dn.arrow.pr'`; then
  459.     echo shar: \"'dn.arrow.pr'\" unpacked with wrong size!
  460. fi
  461. # end of 'dn.arrow.pr'
  462. fi
  463. if test -f 'edit_menu.c' -a "${1}" != "-c" ; then 
  464.   echo shar: Will not clobber existing file \"'edit_menu.c'\"
  465. else
  466. echo shar: Extracting \"'edit_menu.c'\" \(3334 characters\)
  467. sed "s/^X//" >'edit_menu.c' <<'END_OF_FILE'
  468. X/* @(#)edit_menu.c    (c) copyright    10/18/86 (Dan Heller) */
  469. X
  470. X/* edit_menu.c
  471. X * 
  472. X * Routine which handles the menu you get when in the msg_win while editing
  473. X * a letter.  This is just a fancy front end for ~ commands (nyuk, nyuk).
  474. X */
  475. X#include "mush.h"
  476. X
  477. X#define EDIT_IT         (char *)'e'
  478. X#define PAGE         (char *)'p'
  479. X#define INC          (char *)'i'
  480. X#define INC_HDR        (char *)'H'
  481. X#define FWD_MSG        (char *)'f'
  482. X#define TO_LIST        (char *)'t'
  483. X#define SUBJECT        (char *)'s'
  484. X#define CC_LIST        (char *)'c'
  485. X#define BC_LIST        (char *)'b'
  486. X#define ALL_HDR        (char *)'h'
  487. X#define SIGN_IT        (char *)'S'
  488. X#define NO_SIGN        (char *)'n'
  489. X#define FORT        (char *)'F'
  490. X#define NO_FORT        (char *)'N'
  491. X#define ERASE       (char *)'E'
  492. X#define SEND           (char *)'X'
  493. X#define ABORT       (char *)'q'
  494. X#define MENU_HELP    (char *)'?'
  495. X
  496. Xstatic struct menuitem edit_items[] = {
  497. X    { MENU_IMAGESTRING,  "Enter Editor",    EDIT_IT  },
  498. X    { MENU_IMAGESTRING,  "Send Letter",        SEND     },
  499. X    { MENU_IMAGESTRING,  "Abort Letter",    ABORT    },
  500. X    { MENU_IMAGESTRING,  "Review Letter",    PAGE     },
  501. X    { MENU_IMAGESTRING,  "Include Message",    INC      },
  502. X    { MENU_IMAGESTRING,  "Inc. msg w/hdr",    INC_HDR  },
  503. X    { MENU_IMAGESTRING,  "Forward message",    FWD_MSG  },
  504. X    { MENU_IMAGESTRING,  "Change To line",    TO_LIST  },
  505. X    { MENU_IMAGESTRING,  "Change Subject",    SUBJECT  },
  506. X    { MENU_IMAGESTRING,  "Change Cc list",    CC_LIST  },
  507. X    { MENU_IMAGESTRING,  "Change Bcc list",    BC_LIST  },
  508. X    { MENU_IMAGESTRING,  "Change All hdrs",    ALL_HDR  },
  509. X    { MENU_IMAGESTRING,  "Add .signature",    SIGN_IT  },
  510. X    { MENU_IMAGESTRING,  "No .signature",    NO_SIGN  },
  511. X    { MENU_IMAGESTRING,  "Add a fortune",    FORT     },
  512. X    { MENU_IMAGESTRING,  "No fortune",        NO_FORT  },
  513. X    { MENU_IMAGESTRING,  "Erase Message",    ERASE    },
  514. X    { MENU_IMAGESTRING,  "Help",        MENU_HELP  }
  515. X};
  516. X
  517. Xstatic struct menu menu = {
  518. X    MENU_IMAGESTRING, "Editing options",
  519. X    sizeof (edit_items) / sizeof (struct menuitem), edit_items,
  520. X    (struct menu *)NULL,
  521. X    NULL
  522. X};
  523. X
  524. Xedit_menu(event, fd)
  525. Xstruct inputevent *event;
  526. X{
  527. X    static char buf[5];
  528. X    struct menuitem *m_item;
  529. X    register char *action, *p = buf+1;
  530. X    struct menu *menu_ptr = &menu;
  531. X
  532. X    if (!(m_item = menu_display(&menu_ptr, event, fd)) || get_hdr_field) {
  533. X    if (get_hdr_field)
  534. X        print("Finish the message header first.");
  535. X    return;
  536. X    }
  537. X    action = m_item->mi_data;
  538. X    if (txt.x > 5)
  539. X    add_to_letter(rite('\n'));  /* flush line for him */
  540. X
  541. X    if (!msg_cnt && (action == INC || action == INC_HDR || action == FWD_MSG)) {
  542. X    print("No messages to include");
  543. X    return;
  544. X    }
  545. X    buf[0] = *escape;
  546. X    switch(action) {
  547. X    case EDIT_IT  : (void) strcpy(p, "v");
  548. X    when PAGE     : (void) strcpy(p, "p");
  549. X    when INC      : (void) strcpy(p, "i");
  550. X    when INC_HDR  : (void) strcpy(p, "H");
  551. X    when ALL_HDR  : (void) strcpy(p, "h");
  552. X    when SUBJECT  : (void) strcpy(p, "s");
  553. X    when TO_LIST  : (void) strcpy(p, "t");
  554. X    when CC_LIST  : (void) strcpy(p, "c");
  555. X    when BC_LIST  : (void) strcpy(p, "b");
  556. X    when FWD_MSG  : (void) strcpy(p, "f");
  557. X    when SIGN_IT  : (void) strcpy(p, "S");
  558. X    when NO_SIGN  : (void) strcpy(p, "S!");
  559. X    when FORT     : (void) strcpy(p, "F");
  560. X    when NO_FORT  : (void) strcpy(p, "F!");
  561. X    when ERASE    : (void) strcpy(p, "E");
  562. X    when ABORT    : (void) strcpy(p, "q");
  563. X    when SEND     : finish_up_letter(); return;
  564. X    otherwise     : (void) strcpy(p, "?");
  565. X    }
  566. X    add_to_letter(buf);
  567. X}
  568. END_OF_FILE
  569. if test 3334 -ne `wc -c <'edit_menu.c'`; then
  570.     echo shar: \"'edit_menu.c'\" unpacked with wrong size!
  571. fi
  572. # end of 'edit_menu.c'
  573. fi
  574. if test -f 'envelope.pr' -a "${1}" != "-c" ; then 
  575.   echo shar: Will not clobber existing file \"'envelope.pr'\"
  576. else
  577. echo shar: Extracting \"'envelope.pr'\" \(247 characters\)
  578. sed "s/^X//" >'envelope.pr' <<'END_OF_FILE'
  579. X/* "@(#)envelope.cursor    2.2    9/3/86 (Dan Heller)"; */
  580. X
  581. X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  582. X */
  583. X    0x0000,0x0000,0xFFFF,0xC003,0xA005,0x9009,0x8811,0x8421,
  584. X    0x8241,0x8181,0x8001,0x8001,0x8001,0xFFFF,0x0000,0x0000
  585. END_OF_FILE
  586. if test 247 -ne `wc -c <'envelope.pr'`; then
  587.     echo shar: \"'envelope.pr'\" unpacked with wrong size!
  588. fi
  589. # end of 'envelope.pr'
  590. fi
  591. if test -f 'expr.c' -a "${1}" != "-c" ; then 
  592.   echo shar: Will not clobber existing file \"'expr.c'\"
  593. else
  594. echo shar: Extracting \"'expr.c'\" \(4054 characters\)
  595. sed "s/^X//" >'expr.c' <<'END_OF_FILE'
  596. X/* @(#)expr.c    2.3    (c) copyright 10/15/86 (Dan Heller) */
  597. X
  598. X#include "mush.h"
  599. X
  600. Xchar *eval_expr();
  601. X
  602. X/* Parse a string (p) to interpret numbers and ranges of numbers (n-m)
  603. X * delimited by whitespace or comma's. Set msg_list bitfields using
  604. X * macros in mush.h.
  605. X * Return the address of the end of whatever we parsed (in case there's
  606. X * more that the calling routine cares to deal with).
  607. X * Finally, remember that user specifies one more than actual message number
  608. X */
  609. Xchar *
  610. Xdo_range(p, list1)
  611. Xregister char *p, *list1;
  612. X{
  613. X    register int num1 = -1, num2 = -1, except = 0;
  614. X    register char *p2;
  615. X    char list2[MAXMSGS_BITS];
  616. X
  617. X    if (!p)
  618. X    return "";
  619. X    while (*p) {
  620. X    if (isdigit(*p) || *p == '$' || *p == '.' || *p == '^') {
  621. X        if (isdigit(*p)) {
  622. X        char c;
  623. X        p2 = p;
  624. X        skipdigits(0);  /* find the end of the digits */
  625. X        c = *p, *p = 0; /* temporarily plug a null */
  626. X        if (!(num2 = chk_msg(p2))) {
  627. X            clear_msg_list(list1);
  628. X            return NULL;
  629. X        }
  630. X        *p = c;
  631. X        } else if (*p == '$')
  632. X        num2 = msg_cnt;
  633. X        else if (*p == '.')
  634. X        p++, num2 = current_msg+1;
  635. X        else if (*p == '^')
  636. X        p++, num2 = 1;
  637. X        if (except)
  638. X        unset_msg_bit(list1, num2-1);
  639. X        else
  640. X        set_msg_bit(list1, num2-1);
  641. X        if (num1 >= 0) {
  642. X        if (num1 > num2) {
  643. X            print("syntax error: range sequence order reversed.\n");
  644. X            clear_msg_list(list1);
  645. X            return NULL;
  646. X        }
  647. X        while (++num1 < num2)
  648. X            if (except)
  649. X            unset_msg_bit(list1, num1-1);
  650. X            else
  651. X            set_msg_bit(list1, num1-1);
  652. X        num1 = num2 = -1;
  653. X        }
  654. X    }
  655. X    /* expressions to evaluate start with a `
  656. X     * p2 points to first char passed the last char parsed.
  657. X     */
  658. X    if (*p == '`') {
  659. X        clear_msg_list(list2);
  660. X        if (!(p = eval_expr(p, list2))) {
  661. X        clear_msg_list(list1);
  662. X        return NULL;
  663. X        } else {
  664. X        if (except)
  665. X            bitput(list2, list1, msg_cnt, &=~) /* MACRO */
  666. X        else
  667. X            bitput(list2, list1, msg_cnt, |=) /* MACRO */
  668. X        }
  669. X    }
  670. X    /* NOT operator: `* {5}' (everything except for 5)
  671. X     * `4-16 {8-10}'  (4 thru 16 except for 8,9,10)
  672. X     */
  673. X    if (*p == '{' || *p == '}') {
  674. X        if (*p == '{' && (except || num1 >= 0))
  675. X        break;
  676. X        if (*p == '}' && !except) {
  677. X        print("syntax error: missing {\n"); /* } */
  678. X        break;
  679. X        }
  680. X        except = !except;
  681. X    } else if (*p == '-')
  682. X        if (num1 >= 0 || !index(" \t{},.*`$", *(p+1)) && !isdigit(*(p+1)))
  683. X        break;
  684. X        else
  685. X        num1 = num2;
  686. X    else if (*p == ',' || *p == '*') {
  687. X        if (num1 >= 0)
  688. X        break;
  689. X        else if (*p == '*') {
  690. X        if (except)
  691. X            clear_msg_list(list1);
  692. X        else
  693. X            for (num1 = 0; num1 < msg_cnt; num1++)
  694. X            set_msg_bit(list1, num1);
  695. X        num1 = -1;
  696. X        }
  697. X    } else if (!index(" \t`", *p))
  698. X        break;
  699. X    if (*p)
  700. X        skipspaces(1); /* don't make user type stuff squished together */
  701. X    }
  702. X    if (num1 >= 0 || except) {
  703. X    if (except)
  704. X  /* { */   print("syntax error: unmatched }\n");
  705. X    else
  706. X        print("syntax error: unfinished range\n");
  707. X    clear_msg_list(list1);
  708. X    return NULL;
  709. X    }
  710. X    return p;
  711. X}
  712. X
  713. X/* evaluate expressions:
  714. X * mail> delete `pick -f root`     deletes all messages from root.
  715. X * mail> save { `pick -s "Re:"` }  save all message that don't have "Re:"
  716. X *                   in the subject header.
  717. X * mail> save `pick -x -s "Re:"`   same
  718. X * args as follows:
  719. X *   p should point to the first ` -- check for it.
  720. X *   on tells whether to turn bits on or off if messages match.
  721. X */
  722. Xchar *
  723. Xeval_expr(p, new_list)
  724. Xregister char *p, new_list[];
  725. X{
  726. X    register char *p2, **argv;
  727. X    int       argc;
  728. X    long      save_flags = glob_flags;
  729. X
  730. X    if (!(p2 = index(++p, '`'))) {
  731. X    print("unmatched backquote (`)\n");
  732. X    return NULL;
  733. X    }
  734. X    *p2 = 0;
  735. X
  736. X    skipspaces(0);
  737. X    if (!*p) {
  738. X    print("Invalid null command\n");
  739. X    return NULL;
  740. X    }
  741. X    turnon(glob_flags, DO_PIPE);
  742. X    /* ignore sigs only because if user interrupts the do_command,
  743. X     * the long jump will corrupt the stack and the program is hosed.
  744. X     * fix is to have layers of jumpbuf's to return to different levels.
  745. X     */
  746. X    turnon(glob_flags, IGN_SIGS);
  747. X    if (*p && (argv = make_command(p, TRPL_NULL, &argc)))
  748. X    (void) do_command(argc, argv, new_list);
  749. X    glob_flags = save_flags;
  750. X    *p2 = '`';
  751. X    return p2+1;
  752. X}
  753. END_OF_FILE
  754. if test 4054 -ne `wc -c <'expr.c'`; then
  755.     echo shar: \"'expr.c'\" unpacked with wrong size!
  756. fi
  757. # end of 'expr.c'
  758. fi
  759. if test -f 'glasses.pr' -a "${1}" != "-c" ; then 
  760.   echo shar: Will not clobber existing file \"'glasses.pr'\"
  761. else
  762. echo shar: Extracting \"'glasses.pr'\" \(246 characters\)
  763. sed "s/^X//" >'glasses.pr' <<'END_OF_FILE'
  764. X/* "@(#)glasses.cursor    2.2    9/3/86 (Dan Heller)"; */
  765. X
  766. X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  767. X */
  768. X    0x0000,0x0000,0x0C06,0x1209,0x1209,0x2211,0x2010,0x4020,
  769. X    0x4020,0x8C40,0xF3C0,0x8C40,0x8C40,0x8C40,0x7380,0x0000
  770. END_OF_FILE
  771. if test 246 -ne `wc -c <'glasses.pr'`; then
  772.     echo shar: \"'glasses.pr'\" unpacked with wrong size!
  773. fi
  774. # end of 'glasses.pr'
  775. fi
  776. if test -f 'hdr_panel.c' -a "${1}" != "-c" ; then 
  777.   echo shar: Will not clobber existing file \"'hdr_panel.c'\"
  778. else
  779. echo shar: Extracting \"'hdr_panel.c'\" \(4107 characters\)
  780. sed "s/^X//" >'hdr_panel.c' <<'END_OF_FILE'
  781. X/* @(#)hdr_panel.c    (c) copyright    10/18/86 (Dan Heller) */
  782. X
  783. X#include "mush.h"
  784. X
  785. Xmake_hdr_panel(choice_args, button_args)
  786. Xchar **choice_args, **button_args;
  787. X{
  788. X    hdr_panel_sw = panel_create(tool,
  789. X    PANEL_HEIGHT, 30,
  790. X    0);
  791. X    hdr_panel = (Panel)hdr_panel_sw->ts_data;
  792. X
  793. X    msg_num_item = panel_create_item(hdr_panel, PANEL_TEXT,
  794. X    PANEL_ATTRIBUTE_LIST,        choice_args,
  795. X    PANEL_ITEM_X,            4,
  796. X    PANEL_ITEM_Y,            4,
  797. X    PANEL_LABEL_STRING,        "Range:",
  798. X    PANEL_MENU_CHOICE_STRINGS,     "Help", 0,
  799. X    PANEL_VALUE_DISPLAY_LENGTH,     10,
  800. X    PANEL_VALUE_STORED_LENGTH,     80,
  801. X    PANEL_LABEL_FONT,         fonts[DEFAULT],
  802. X    PANEL_NOTIFY_STRING,         "\n\r",
  803. X    PANEL_NOTIFY_PROC,         msg_num_done,
  804. X    0);
  805. X
  806. X    sub_hdr_item[0] = panel_create_item(hdr_panel, PANEL_CHOICE,
  807. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  808. X    PANEL_ITEM_X,            149,
  809. X    PANEL_ITEM_Y,            4,
  810. X    PANEL_LABEL_IMAGE,            &mouse_left,
  811. X    PANEL_CHOICE_STRINGS,         "Help", 0,
  812. X    PANEL_NOTIFY_PROC,            read_mail,
  813. X    0);
  814. X    sub_hdr_item[1] = panel_create_item(hdr_panel, PANEL_CHOICE,
  815. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  816. X    PANEL_ITEM_X,            174,
  817. X    PANEL_ITEM_Y,            4,
  818. X    PANEL_LABEL_STRING,           "Read ",
  819. X    PANEL_MENU_TITLE_IMAGE,     &mouse_left,
  820. X    PANEL_CHOICE_STRINGS,        "Help", 0,
  821. X    PANEL_NOTIFY_PROC,            read_mail,
  822. X    0);
  823. X    sub_hdr_item[2] = panel_create_item(hdr_panel, PANEL_CHOICE,
  824. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  825. X    PANEL_ITEM_X,            223,
  826. X    PANEL_ITEM_Y,            4,
  827. X    PANEL_LABEL_IMAGE,            &mouse_middle,
  828. X    PANEL_CHOICE_STRINGS,         "Help", 0,
  829. X    PANEL_NOTIFY_PROC,            delete_mail,
  830. X    0);
  831. X    sub_hdr_item[3] = panel_create_item(hdr_panel, PANEL_CHOICE,
  832. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  833. X    PANEL_ITEM_X,            248,
  834. X    PANEL_ITEM_Y,            4,
  835. X    PANEL_LABEL_STRING,           "Delete ",
  836. X    PANEL_MENU_TITLE_IMAGE,     &mouse_middle,
  837. X    PANEL_CHOICE_STRINGS,         "Help", 0,
  838. X    PANEL_NOTIFY_PROC,            delete_mail,
  839. X    0);
  840. X    sub_hdr_item[4] = panel_create_item(hdr_panel, PANEL_CHOICE,
  841. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  842. X    PANEL_ITEM_X,            313,
  843. X    PANEL_ITEM_Y,            4,
  844. X    PANEL_LABEL_IMAGE,            &mouse_right,
  845. X    PANEL_CHOICE_STRINGS,         "Help", 0,
  846. X    PANEL_NOTIFY_PROC,            read_mail,
  847. X    0);
  848. X    sub_hdr_item[5] = panel_create_item(hdr_panel, PANEL_CHOICE,
  849. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  850. X    PANEL_ITEM_X,            338,
  851. X    PANEL_ITEM_Y,            4,
  852. X    PANEL_LABEL_STRING,           "Menu ",
  853. X    PANEL_MENU_TITLE_IMAGE,            &mouse_right,
  854. X    PANEL_CHOICE_STRINGS,         "Help", 0,
  855. X    PANEL_NOTIFY_PROC,            read_mail,
  856. X    0);
  857. X
  858. X    hdr_display = panel_create_item(hdr_panel, PANEL_CHOICE,
  859. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  860. X    PANEL_ITEM_X,            387,
  861. X    PANEL_ITEM_Y,            4,
  862. X    PANEL_LABEL_IMAGE,
  863. X        panel_button_image(hdr_panel, "Display", 7, fonts[DEFAULT]),
  864. X    PANEL_MENU_TITLE_STRING,     "Header Display Formats",
  865. X    PANEL_CHOICE_STRINGS,         "Show Deleted Messages",
  866. X                    "Don't Show Deleted Messages",
  867. X                    "Current Header in Bold Text",
  868. X                    "Current Header in Reverse Text",
  869. X                    "Help",
  870. X                    0,
  871. X    PANEL_NOTIFY_PROC,         display_hdrs,
  872. X    0);
  873. X
  874. X    ignore_item = panel_create_item(hdr_panel, PANEL_CHOICE,
  875. X    PANEL_ATTRIBUTE_LIST, choice_args,
  876. X    PANEL_ITEM_X,            464,
  877. X    PANEL_ITEM_Y,            4,
  878. X    PANEL_LABEL_IMAGE,
  879. X        panel_button_image(hdr_panel, "Headers", 7, fonts[DEFAULT]),
  880. X    PANEL_MENU_TITLE_STRING,     "Ignored Headers",
  881. X    PANEL_CHOICE_STRINGS,         "Current Settings",
  882. X                    "Add Values",
  883. X                    "Delete Values",
  884. X                    "Help",
  885. X                    0,
  886. X    PANEL_NOTIFY_PROC,         p_set_opts,
  887. X    0);
  888. X
  889. X    next_scr = panel_create_item(hdr_panel, PANEL_CHOICE,
  890. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  891. X    PANEL_ITEM_X,            541,
  892. X    PANEL_ITEM_Y,            4,
  893. X    PANEL_LABEL_IMAGE,
  894. X        panel_button_image(hdr_panel, "Next", 4, fonts[DEFAULT]),
  895. X    PANEL_MENU_TITLE_STRING,     "Display Message Headers",
  896. X    PANEL_CHOICE_STRINGS,         "Show Next screenful",
  897. X                    "Show Previous screenful",
  898. X                    0,
  899. X    PANEL_SHOW_ITEM,         FALSE,
  900. X    PANEL_NOTIFY_PROC,        do_hdr,
  901. X    0);
  902. X
  903. X    prev_scr = panel_create_item(hdr_panel, PANEL_CHOICE,
  904. X    PANEL_ATTRIBUTE_LIST,         choice_args,
  905. X    PANEL_ITEM_X,            594,
  906. X    PANEL_ITEM_Y,            4,
  907. X    PANEL_LABEL_IMAGE,
  908. X        panel_button_image(hdr_panel, "Prev", 4, fonts[DEFAULT]),
  909. X    PANEL_MENU_TITLE_STRING,     "Display Message Headers",
  910. X    PANEL_CHOICE_STRINGS,         "Show Previous screenful",
  911. X                    "Show Next screenful",
  912. X                    0,
  913. X    PANEL_SHOW_ITEM,         FALSE,
  914. X    PANEL_NOTIFY_PROC,         do_hdr,
  915. X    0);
  916. X}
  917. END_OF_FILE
  918. if test 4107 -ne `wc -c <'hdr_panel.c'`; then
  919.     echo shar: \"'hdr_panel.c'\" unpacked with wrong size!
  920. fi
  921. # end of 'hdr_panel.c'
  922. fi
  923. if test -f 'hdr_procs.c' -a "${1}" != "-c" ; then 
  924.   echo shar: Will not clobber existing file \"'hdr_procs.c'\"
  925. else
  926. echo shar: Extracting \"'hdr_procs.c'\" \(3944 characters\)
  927. sed "s/^X//" >'hdr_procs.c' <<'END_OF_FILE'
  928. X/* @(#)hdr_procs.c    (c) copyright    10/18/86 (Dan Heller) */
  929. X
  930. X/* hdr_procs.c  -- panel item procedures for the message hdrs */
  931. X#include "mush.h"
  932. X
  933. X/* which message headers are to be displayed */
  934. Xdo_hdr(foo, value, event)
  935. XPanel_item foo;
  936. Xint value;
  937. Xstruct inputevent *event;
  938. X{
  939. X    register char *argv[3];
  940. X    argv[2] = NULL;
  941. X    argv[0] = "headers";
  942. X
  943. X    if (!msg_cnt) {
  944. X    print("No Mail.");
  945. X    return;
  946. X    }
  947. X    if (!value || event->ie_code == MS_LEFT)
  948. X    argv[1] = (foo == next_scr)? "+": "-";
  949. X    else
  950. X    argv[1] = (foo == next_scr)? "-": "+";
  951. X
  952. X    panel_set(foo, PANEL_VALUE, 0, 0);
  953. X    (void) do_hdrs(2, argv, NULL);
  954. X}
  955. X
  956. X/* alters display of the message headers */
  957. Xdisplay_hdrs(foo, value, event)
  958. XPanel_item foo;
  959. Xint value;
  960. Xstruct inputevent *event;
  961. X{
  962. X    int show_deleted = !!do_set(set_options, "show_deleted");
  963. X
  964. X    if (event->ie_code != MS_LEFT) {
  965. X    switch(value) {
  966. X        case 0 : case 1: {
  967. X        char buf[25];
  968. X        show_deleted = !value;
  969. X        (void) cmd_line(sprintf(buf, "%sset show_deleted",
  970. X            (value == 0)? "" : "un"), msg_list);
  971. X        }
  972. X        when 2 :
  973. X        turnoff(glob_flags, REV_VIDEO);
  974. X        when 3 :
  975. X        turnon(glob_flags, REV_VIDEO);
  976. X        when 4:
  977. X        return help(hdr_panel_sw->ts_windowfd, "headers", tool_help);
  978. X    }
  979. X    (void) do_hdrs(0, DUBL_NULL, NULL);
  980. X    }
  981. X    print("%sShow Deleted headers, \"Current Message\" header in %s",
  982. X            (show_deleted)? NO_STRING: "Don't ",
  983. X            (ison(glob_flags, REV_VIDEO))? "reverse": "boldface");
  984. X}
  985. X
  986. Xp_set_opts(item, value, event)
  987. XPanel_item item;
  988. Xint value;
  989. Xstruct inputevent *event;
  990. X{
  991. X    static char   *p, *oldp;
  992. X    static char   buf[8];
  993. X
  994. X    if (event->ie_code == MS_LEFT)
  995. X    value = 0;
  996. X    if (value && (value != 3 || value != 2)
  997. X          && panel_get(input_item, PANEL_SHOW_ITEM)) {
  998. X    print("Need value for %s first!", oldp);
  999. X    return;
  1000. X    } else if (!value && ison(glob_flags, IS_GETTING)) {
  1001. X    print("Finish editing letter first");
  1002. X    return;
  1003. X    } else if (item == option_item) {
  1004. X    if (!value) /* first menu item */
  1005. X        view_options();
  1006. X    else if (value == 1)
  1007. X        set_fkeys();
  1008. X    else
  1009. X        (void) help(panel_sw->ts_windowfd, "opts", tool_help);
  1010. X    return;
  1011. X    } else if (item == ignore_item)
  1012. X    if (value == 3)
  1013. X        return help(hdr_panel_sw->ts_windowfd, "ignore", tool_help);
  1014. X    else
  1015. X        oldp = p = strcpy(buf, "ignore");
  1016. X    else if (item == alias_item)
  1017. X    if (value == 3)
  1018. X        return help(panel_sw->ts_windowfd, "aliases", tool_help);
  1019. X    else
  1020. X        oldp = p = strcpy(buf, "alias");
  1021. X    if (value) {
  1022. X    char tmp[30];
  1023. X    (void) sprintf(tmp, "%set %s:", (value == 1)? "S": "Uns", p);
  1024. X    panel_set(input_item,
  1025. X        PANEL_LABEL_STRING, tmp,
  1026. X        PANEL_MENU_CHOICE_STRINGS, "Abort", 0,
  1027. X        PANEL_SHOW_ITEM, TRUE,
  1028. X        0);
  1029. X    oldp = p;
  1030. X    return;
  1031. X    }
  1032. X    panel_set(item, PANEL_VALUE, 0, 0);
  1033. X    do_clear();
  1034. X    pw_text(msg_win, l_width(DEFAULT), 15, PIX_SRC, fonts[LARGE], p);
  1035. X    if (item != ignore_item)
  1036. X    pw_text(msg_win, 30*l_width(DEFAULT),15,PIX_SRC,fonts[LARGE],"Values");
  1037. X    (void) cmd_line(p, msg_list);
  1038. X}
  1039. X
  1040. Xmsg_num_done(item, event)
  1041. XPanel_item item;
  1042. Xstruct inputevent *event;
  1043. X{
  1044. X    char buf[82];
  1045. X    register char *p;
  1046. X    int n;
  1047. X
  1048. X    if (event->ie_code != '\n' && event->ie_code != '\r')
  1049. X    return help(hdr_panel_sw->ts_windowfd, "message range", tool_help);
  1050. X    (void) sprintf(buf, "headers %s", (p = (char *)panel_get_value(item)));
  1051. X    panel_set(item, PANEL_VALUE, NO_STRING, 0);
  1052. X    if (!(n = chk_msg(p)))
  1053. X    return;
  1054. X    current_msg = --n;
  1055. X    (void) cmd_line(buf, msg_list);
  1056. X    display_msg(n, (long)0);
  1057. X}
  1058. X
  1059. Xdo_sort(item, value, event)
  1060. XPanel_item item;
  1061. Xint value;
  1062. Xstruct inputevent *event;
  1063. X{
  1064. X    register char *argv[3];
  1065. X    argv[0] = "sort";
  1066. X    argv[2] = NULL;
  1067. X    if (event->ie_code == MS_LEFT)
  1068. X    argv[1] = do_set(set_options, "sort");
  1069. X    else switch(value) {
  1070. X    case 0: argv[1] = "d";
  1071. X    when 1: argv[1] = "a";
  1072. X    when 2: argv[1] = "s";
  1073. X    when 3: argv[1] = "S";
  1074. X    when 4: argv[1] = "R";
  1075. X    when 5: argv[1] = "-?";
  1076. X    }
  1077. X    (void) sort(2, argv, NULL);
  1078. X    if (value != 5)
  1079. X    (void) do_hdrs(0, DUBL_NULL, NULL);
  1080. X    panel_set(item, PANEL_VALUE, 0, 0);
  1081. X}
  1082. END_OF_FILE
  1083. if test 3944 -ne `wc -c <'hdr_procs.c'`; then
  1084.     echo shar: \"'hdr_procs.c'\" unpacked with wrong size!
  1085. fi
  1086. # end of 'hdr_procs.c'
  1087. fi
  1088. if test -f 'mail.icon.1' -a "${1}" != "-c" ; then 
  1089.   echo shar: Will not clobber existing file \"'mail.icon.1'\"
  1090. else
  1091. echo shar: Extracting \"'mail.icon.1'\" \(1933 characters\)
  1092. sed "s/^X//" >'mail.icon.1' <<'END_OF_FILE'
  1093. X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  1094. X */
  1095. X    0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
  1096. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  1097. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  1098. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  1099. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x1FFF,0xFFFF,0xFE01,
  1100. X    0x8000,0xFE00,0x0000,0x0181,0x8007,0x01C0,0x0000,0x0061,
  1101. X    0x8018,0x0030,0x0000,0x0011,0x8020,0x7008,0x0000,0x0011,
  1102. X    0x80C1,0xFC06,0x0000,0x0009,0x8101,0xFC01,0x0000,0x0009,
  1103. X    0x8103,0xFE01,0x0000,0x0005,0x8203,0xFE00,0x8000,0x0005,
  1104. X    0x8403,0xFE00,0x4000,0x0005,0x8401,0xFC00,0x4000,0x0005,
  1105. X    0x8801,0xFC00,0x2000,0x0005,0x8800,0x7000,0x2000,0x0005,
  1106. X    0x8800,0x0000,0x3000,0x0005,0x9000,0x0000,0x1000,0x0005,
  1107. X    0x9000,0x0000,0x1000,0x0005,0x93FF,0xFFFF,0x9000,0x0025,
  1108. X    0xA200,0x0000,0x9000,0x00E5,0xA200,0x0000,0x9000,0x03A5,
  1109. X    0xA200,0x0000,0x9000,0x0625,0xA3FF,0xFFFF,0x9000,0x1C25,
  1110. X    0xA000,0x0000,0x1000,0x3425,0xA000,0x0000,0x1000,0xC425,
  1111. X    0xA000,0x0000,0x1003,0x8425,0xA000,0x0000,0x1006,0x0425,
  1112. X    0xA000,0x0000,0x101C,0x0425,0xA000,0x0000,0x11F0,0x0425,
  1113. X    0xA000,0x0000,0x13E0,0x0445,0xA000,0x0000,0x13E0,0x0585,
  1114. X    0xA000,0x0000,0x13E0,0x0605,0xA000,0x0000,0x11C0,0x0405,
  1115. X    0xA000,0x0000,0x1000,0x000D,0xA000,0x0000,0x1000,0x0011,
  1116. X    0xA000,0x0000,0x1000,0x0021,0xA000,0x0000,0x1000,0x00C1,
  1117. X    0xA000,0x0000,0x1000,0x0101,0xA000,0x0000,0x1000,0x0601,
  1118. X    0xA000,0x0000,0x1000,0x0801,0xA000,0x0000,0x1000,0x3801,
  1119. X    0xA000,0x0000,0x1000,0x4801,0xA000,0x0000,0x1000,0x8801,
  1120. X    0xA000,0x0000,0x1003,0x0801,0xA000,0x0000,0x1004,0x0801,
  1121. X    0xA000,0x0000,0x101C,0x0801,0xA000,0x0000,0x1024,0x0801,
  1122. X    0xA000,0x0000,0x1044,0x0801,0xA000,0x0000,0x1184,0x0801,
  1123. X    0xA000,0x0000,0x1204,0x0801,0xA000,0x0000,0x1404,0x0801,
  1124. X    0xBFFF,0xFFFF,0xF804,0x0801,0x8000,0x0000,0x0004,0x0801,
  1125. X    0x8000,0x0000,0x0004,0x0801,0x8000,0x0000,0x0004,0x0801,
  1126. X    0x8000,0x0000,0x0004,0x0801,0xFFFF,0xFFFF,0xFFFF,0xFFFF
  1127. END_OF_FILE
  1128. if test 1933 -ne `wc -c <'mail.icon.1'`; then
  1129.     echo shar: \"'mail.icon.1'\" unpacked with wrong size!
  1130. fi
  1131. # end of 'mail.icon.1'
  1132. fi
  1133. if test -f 'mail.icon.2' -a "${1}" != "-c" ; then 
  1134.   echo shar: Will not clobber existing file \"'mail.icon.2'\"
  1135. else
  1136. echo shar: Extracting \"'mail.icon.2'\" \(1933 characters\)
  1137. sed "s/^X//" >'mail.icon.2' <<'END_OF_FILE'
  1138. X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  1139. X */
  1140. X    0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
  1141. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x00E0,0x0001,
  1142. X    0x8000,0x0000,0x00DE,0x0001,0x8000,0x0000,0x00C1,0xE001,
  1143. X    0x8000,0x0000,0x00C0,0x1801,0x8000,0x0000,0x00C0,0x0801,
  1144. X    0x8000,0x0000,0x00C0,0x0801,0x8000,0x1FFF,0xFFC0,0x0E01,
  1145. X    0x8000,0xFE00,0x00C0,0x0981,0x8007,0x01C0,0x00C0,0x0861,
  1146. X    0x8018,0x0030,0x00C0,0x0811,0x8020,0x7008,0x00C0,0x0811,
  1147. X    0x80C1,0xFC06,0x00C0,0x1809,0x8101,0xBC01,0x00C0,0x6009,
  1148. X    0x8103,0x1E01,0x00C1,0x8005,0x8202,0x0E00,0x80C6,0x0005,
  1149. X    0x8404,0x0400,0x40D8,0x0005,0x8408,0x0200,0x40E0,0x0005,
  1150. X    0x8810,0x0100,0x20C0,0x0005,0x8820,0x6080,0x20C0,0x0005,
  1151. X    0x8840,0x4040,0x30C0,0x0005,0x9081,0x3020,0x10C0,0x0005,
  1152. X    0x9041,0x9C10,0x10C0,0x0005,0x93E0,0x8A0F,0x90C0,0x0005,
  1153. X    0xA210,0x6404,0x90C0,0x0005,0xA208,0x3002,0x90C0,0x0005,
  1154. X    0xA204,0x1401,0x90C0,0x0005,0xA3FF,0xFFFF,0x90C0,0x0005,
  1155. X    0xA000,0x0000,0x10C0,0x0005,0xA000,0x0000,0x10C0,0x0005,
  1156. X    0xA000,0x0000,0x10C0,0x0005,0xA000,0x0000,0x10C0,0x0005,
  1157. X    0xA000,0x0000,0x10C0,0x0005,0xA000,0x0000,0x11C0,0x0005,
  1158. X    0xA000,0x0000,0x13E0,0x0005,0xA000,0x0000,0x13E0,0x0005,
  1159. X    0xA000,0x0000,0x13E0,0x0005,0xA000,0x0000,0x11C0,0x0005,
  1160. X    0xA000,0x0000,0x1000,0x000D,0xA000,0x0000,0x1000,0x0011,
  1161. X    0xA000,0x0000,0x1000,0x0021,0xA000,0x0000,0x1000,0x00C1,
  1162. X    0xA000,0x0000,0x1000,0x0101,0xA000,0x0000,0x1000,0x0601,
  1163. X    0xA000,0x0000,0x1000,0x0801,0xA000,0x0000,0x1000,0x3001,
  1164. X    0xA000,0x0000,0x1000,0x4001,0xA000,0x0000,0x1000,0x8001,
  1165. X    0xA000,0x0000,0x1003,0x8001,0xA000,0x0000,0x1004,0x8001,
  1166. X    0xA000,0x0000,0x1018,0x8001,0xA000,0x0000,0x1020,0x8001,
  1167. X    0xA000,0x0000,0x1060,0x8001,0xA000,0x0000,0x1180,0x8001,
  1168. X    0xA000,0x0000,0x1280,0x8001,0xA000,0x0000,0x1480,0x8001,
  1169. X    0xBFFF,0xFFFF,0xFC80,0x8001,0x8000,0x0000,0x0080,0x8001,
  1170. X    0x8000,0x0000,0x0080,0x8001,0x8000,0x0000,0x0080,0x8001,
  1171. X    0x8000,0x0000,0x0080,0x8001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
  1172. END_OF_FILE
  1173. if test 1933 -ne `wc -c <'mail.icon.2'`; then
  1174.     echo shar: \"'mail.icon.2'\" unpacked with wrong size!
  1175. fi
  1176. # end of 'mail.icon.2'
  1177. fi
  1178. if test -f 'makefile.bsd' -a "${1}" != "-c" ; then 
  1179.   echo shar: Will not clobber existing file \"'makefile.bsd'\"
  1180. else
  1181. echo shar: Extracting \"'makefile.bsd'\" \(863 characters\)
  1182. sed "s/^X//" >'makefile.bsd' <<'END_OF_FILE'
  1183. X# makefile.bsd    (c) copyright 1986    (Dan Heller)
  1184. X#
  1185. XHDRS= mush.h config.h-dist strings.h bindings.h
  1186. XSRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c print.c \
  1187. X      signals.c aliases.c setopts.c msgs.c pick.c sort.c expr.c \
  1188. X      folders.c dates.c loop.c help.c viewopts.c curses.c curs_io.c bind.c
  1189. XOBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o \
  1190. X      signals.o aliases.o setopts.o msgs.o pick.o sort.o expr.o \
  1191. X      folders.o dates.o loop.o help.o viewopts.o curses.o curs_io.o bind.o
  1192. XHELP_FILES= README cmd_help mush.1
  1193. X
  1194. XCFLAGS= -O -DCURSES -DBSD
  1195. XLDFLAGS= -s
  1196. XLINTFLAGS= -bxah -Dlint -DCURSES -DBSD
  1197. XLIBES= -lcurses -ltermlib
  1198. X
  1199. Xmush: $(OBJS)
  1200. X    @echo loading...
  1201. X    @cc $(LDFLAGS) $(OBJS) $(LIBES) -o mush
  1202. X
  1203. Xtar:
  1204. X    @tar fcv MUSH $(HDRS) $(SRCS) makefile.bsd $(HELP_FILES)
  1205. X
  1206. Xlint:
  1207. X    lint $(LINTFLAGS) $(SRCS)
  1208. X
  1209. Xclean:
  1210. X    rm -f *.o core mush
  1211. END_OF_FILE
  1212. if test 863 -ne `wc -c <'makefile.bsd'`; then
  1213.     echo shar: \"'makefile.bsd'\" unpacked with wrong size!
  1214. fi
  1215. # end of 'makefile.bsd'
  1216. fi
  1217. if test -f 'makefile.sun' -a "${1}" != "-c" ; then 
  1218.   echo shar: Will not clobber existing file \"'makefile.sun'\"
  1219. else
  1220. echo shar: Extracting \"'makefile.sun'\" \(1292 characters\)
  1221. sed "s/^X//" >'makefile.sun' <<'END_OF_FILE'
  1222. X# makefile.sun    (c) copyright 1986    (Dan Heller)
  1223. X#
  1224. XHDRS= mush.h config.h-dist strings.h bindings.h
  1225. X
  1226. XSRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c rite.c \
  1227. X      select.c doproc.c print.c signals.c aliases.c setopts.c msgs.c \
  1228. X      hdr_procs.c tool.c hdr_panel.c main_panel.c help.c viewopts.c sort.c \
  1229. X      pick.c fkeys.c expr.c folders.c dates.c loop.c edit_menu.c \
  1230. X      curses.c curs_io.c bind.c
  1231. X
  1232. XOBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o rite.o \
  1233. X      select.o doproc.o print.o signals.o aliases.o setopts.o msgs.o \
  1234. X      hdr_procs.o tool.o hdr_panel.o main_panel.o help.o viewopts.o sort.o \
  1235. X      pick.o fkeys.o expr.o folders.o dates.o loop.o edit_menu.o \
  1236. X      curses.o curs_io.o bind.o
  1237. X
  1238. XIMAGES= mail.icon.1 mail.icon.2 check.pr cycle.pr envelope.pr glasses.pr \
  1239. X    write.pr up.arrow.pr dn.arrow.pr coffee.cup.pr
  1240. X
  1241. XHELP_FILES= README cmd_help tool_help mush.1
  1242. X
  1243. XMAKES= makefile.sun makefile.bsd makefile.sys.v
  1244. X
  1245. XCFLAGS= -O -DSUNTOOL -DCURSES -DBSD
  1246. XLDFLAGS= -s
  1247. XLIBES= -lcurses -ltermlib -lsuntool -lsunwindow -lpixrect
  1248. XLINTFLAGS= -bxah -Dlint
  1249. X
  1250. Xmush: $(OBJS)
  1251. X    @echo loading...
  1252. X    @cc $(LDFLAGS) $(OBJS) $(LIBES) -o mush
  1253. X
  1254. Xtar:
  1255. X    @tar fcv MUSH $(HDRS) $(SRCS) $(IMAGES) $(HELP_FILES) $(MAKES)
  1256. X
  1257. Xlint:
  1258. X    make -f makefile.bsd lint
  1259. X
  1260. Xclean:
  1261. X    rm -f *.o core mush
  1262. END_OF_FILE
  1263. if test 1292 -ne `wc -c <'makefile.sun'`; then
  1264.     echo shar: \"'makefile.sun'\" unpacked with wrong size!
  1265. fi
  1266. # end of 'makefile.sun'
  1267. fi
  1268. if test -f 'makefile.sys.v' -a "${1}" != "-c" ; then 
  1269.   echo shar: Will not clobber existing file \"'makefile.sys.v'\"
  1270. else
  1271. echo shar: Extracting \"'makefile.sys.v'\" \(1162 characters\)
  1272. sed "s/^X//" >'makefile.sys.v' <<'END_OF_FILE'
  1273. XHDRS= mush.h config.h-dist strings.h bindings.h
  1274. XSRCS1= main.c init.c misc.c execute.c
  1275. XSRCS2= signals.c aliases.c msgs.c pick.c viewopts.c
  1276. XSRCS3= sort.c expr.c folders.c dates.c help.c
  1277. XSRCS4= loop.c bind.c
  1278. XSRCS5= commands.c setopts.c hdrs.c
  1279. XSRCS6= mail.c print.c
  1280. XSRCS7= curses.c curs_io.c
  1281. XOBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o \
  1282. X      signals.o aliases.o setopts.o msgs.o pick.o sort.o expr.o \
  1283. X      folders.o dates.o loop.o help.o viewopts.o bind.o curses.o curs_io.o
  1284. XDOCS= README cmd_help mush.1
  1285. X
  1286. XCFLAGS= -DSYSV -Mle -DCURSES
  1287. XLDFLAGS= -X -Mle -lx -F 3000 -lcurses -ltermlib
  1288. X
  1289. Xmush: $(OBJS)
  1290. X    @echo loading...
  1291. X    @cc $(LDFLAGS) $(OBJS) -o mush
  1292. X
  1293. Xmisc.o:    misc.c
  1294. X    cc $(CFLAGS) -LARGE -c misc.c
  1295. X
  1296. Xbind.o:    bind.c
  1297. X    cc $(CFLAGS) -LARGE -c bind.c
  1298. X
  1299. Xshar:
  1300. X    shar makefile.sys.v makefile.bsd ${DOCS} ${HDRS} > hdr.shr
  1301. X    shar ${SRCS1} > src1.shr
  1302. X    shar ${SRCS2} > src2.shr
  1303. X    shar ${SRCS3} > src3.shr
  1304. X    shar ${SRCS4} > src4.shr
  1305. X    shar ${SRCS5} > src5.shr
  1306. X    shar ${SRCS6} > src6.shr
  1307. X    shar ${SRCS7} > src7.shr
  1308. X
  1309. Xtar:
  1310. X    tar fcv MUSH makefile.sys.v ${HDRS} ${DOCS} ${SRCS1} ${SRCS2} ${SRCS3} \
  1311. X    ${SRCS4} ${SRCS5} ${SRCS6} ${SRCS7}
  1312. X
  1313. Xclean:
  1314. X    rm -f *.o core mush
  1315. END_OF_FILE
  1316. if test 1162 -ne `wc -c <'makefile.sys.v'`; then
  1317.     echo shar: \"'makefile.sys.v'\" unpacked with wrong size!
  1318. fi
  1319. # end of 'makefile.sys.v'
  1320. fi
  1321. if test -f 'print.c' -a "${1}" != "-c" ; then 
  1322.   echo shar: Will not clobber existing file \"'print.c'\"
  1323. else
  1324. echo shar: Extracting \"'print.c'\" \(4092 characters\)
  1325. sed "s/^X//" >'print.c' <<'END_OF_FILE'
  1326. X/* @(#)print.c    2.4    (c) copyright 10/15/86 (Dan Heller) */
  1327. X
  1328. X#include "mush.h"
  1329. X
  1330. X/*ARGSUSED*/
  1331. X/*VARARGS1*/
  1332. Xvoid
  1333. Xerror(fmt, arg1, arg2, arg3, arg4)
  1334. Xregister char *fmt;
  1335. Xchar *arg1, *arg2, *arg3, *arg4;
  1336. X{
  1337. X    print(fmt, arg1, arg2, arg3, arg4);
  1338. X    print_more(": %s\n", sys_errlist[errno]);
  1339. X}
  1340. X
  1341. X#if defined(SUNTOOL) || defined(CURSES)
  1342. X/*
  1343. X * print just like printf -- to a window, to curses, or to stdout.  Use vprintf
  1344. X * if available.  msgbuf is the buffer used to print into if necessary.
  1345. X * If you're running SUN3.2 or higher, the typecast (unsigned char *)msgbuf
  1346. X * (where indicated) otherwise, msgbuf is not typecast at all.
  1347. X * Also note same casting in wprint().
  1348. X */
  1349. X/*VARARGS1*/
  1350. Xvoid
  1351. Xprint(fmt, args)
  1352. Xregister char *fmt;
  1353. Xchar *args;
  1354. X{
  1355. X    static char msgbuf[BUFSIZ];
  1356. X#ifndef VPRINTF
  1357. X    FILE foo;
  1358. X#endif VPRINTF
  1359. X#ifdef SUNTOOL
  1360. X    static int x;
  1361. X#endif SUNTOOL
  1362. X    char *p; /* same type as struct file _ptr,_buf in stdio.h */
  1363. X
  1364. X#ifdef CURSES
  1365. X    if (iscurses) {
  1366. X    if (isoff(glob_flags, CONT_PRNT))
  1367. X        move(LINES-1, 0), refresh();
  1368. X    turnoff(glob_flags, CONT_PRNT);
  1369. X    } else
  1370. X#endif CURSES
  1371. X    if (istool < 2) {
  1372. X#ifdef VPRINTF
  1373. X        vprintf(fmt, &args), fflush(stdout);
  1374. X#else
  1375. X        _doprnt(fmt, &args, stdout), fflush(stdout);
  1376. X#endif VPRINTF
  1377. X        return;
  1378. X    }
  1379. X#ifdef VPRINTF
  1380. X    if (fmt)
  1381. X    vsprintf(msgbuf, fmt, &args); /* NULL in fmt reprints last msg */
  1382. X#else VPRINTF
  1383. X    foo._cnt = BUFSIZ;
  1384. X    foo._base = foo._ptr = msgbuf; /* may have to be cast(unsigned char *) */
  1385. X    foo._flag = _IOWRT+_IOSTRG;
  1386. X    if (fmt) {   /* passing NULL (not "") reprints last message */
  1387. X    (void) _doprnt(fmt, &args, &foo);
  1388. X    *foo._ptr = '\0'; /* plant terminating null character */
  1389. X    }
  1390. X#endif VPIRNTF
  1391. X    p = msgbuf;
  1392. X    if (iscurses || istool)
  1393. X    while (p = index(p, '\n'))
  1394. X        *p = ' ';
  1395. X#ifdef CURSES
  1396. X    if (iscurses) {
  1397. X    addstr(msgbuf), clrtoeol(), refresh();
  1398. X    return;
  1399. X    }
  1400. X#endif CURSES
  1401. X#ifdef SUNTOOL
  1402. X    if (isoff(glob_flags, CONT_PRNT))
  1403. X    x = 5;
  1404. X    turnoff(glob_flags, CONT_PRNT);
  1405. X    pw_text(print_win, x,   l_height(LARGE), PIX_SRC, fonts[LARGE], msgbuf);
  1406. X    pw_text(print_win, x+1, l_height(LARGE), PIX_SRC|PIX_DST,
  1407. X               fonts[LARGE], msgbuf);
  1408. X    x += strlen(msgbuf) * l_width(LARGE);
  1409. X    Clrtoeol(print_win, x, l_height(LARGE), LARGE);
  1410. X#endif SUNTOOL
  1411. X}
  1412. X#endif SUNTOOL || CURSES
  1413. X
  1414. X#ifdef SUNTOOL
  1415. X/*VARARGS*/
  1416. Xvoid
  1417. Xwprint(fmt, args)
  1418. Xchar *fmt, *args;
  1419. X{
  1420. X#ifndef VPRINTF
  1421. X    FILE foo;
  1422. X#endif VPRINTF
  1423. X    char msgbuf[BUFSIZ]; /* we're not getting huge strings */
  1424. X
  1425. X    if (istool < 2) {
  1426. X#ifdef VPRINTF
  1427. X    vprintf(fmt, &args);
  1428. X#else VPRINTF
  1429. X    _doprnt(fmt, &args, stdout);
  1430. X#endif VPRINTF
  1431. X    fflush(stdout);
  1432. X    return;
  1433. X    }
  1434. X    if (!fmt)
  1435. X    return;
  1436. X#ifdef VPRINTF
  1437. X    vsprintf(msgbuf, fmt, &args); /* NULL in fmt reprints last msg */
  1438. X#else VPRINTF
  1439. X    foo._cnt = BUFSIZ;
  1440. X    foo._base = foo._ptr = msgbuf; /* may have to typecast (unsigned char *) */
  1441. X    foo._flag = _IOWRT+_IOSTRG;
  1442. X    _doprnt(fmt, &args, &foo); /* format like printf into msgbuf via foo */
  1443. X    *foo._ptr = '\0'; /* plant terminating null character */
  1444. X#endif VPRINTF
  1445. X    Addstr(msgbuf);  /* addstr() will scroll if necessary */
  1446. X}
  1447. X
  1448. X/*
  1449. X * scroll the msg_win "lines"
  1450. X * if `lines' is negative (backwards scroll) msg_pix can't be NULL
  1451. X */
  1452. Xvoid
  1453. Xscroll_win(lines)
  1454. Xregister int lines;
  1455. X{
  1456. X    register int y = lines * l_height(curfont);
  1457. X    if (txt.y + y < msg_rect.r_height)
  1458. X    y = 0;  /* temporary */
  1459. X    txt.x = 5;
  1460. X
  1461. X    if (msg_pix) {
  1462. X    if (txt.y + y >= msg_pix->pr_size.y - 5)
  1463. X        y = msg_pix->pr_size.y - txt.y;
  1464. X    still_more += y; /* let scrolling know where we are */
  1465. X    txt.y += y;
  1466. X    pw_rop(msg_win, 0, 5,
  1467. X           msg_rect.r_width, crt * l_height(curfont),
  1468. X           PIX_SRC, msg_pix, 0, txt.y - msg_rect.r_height + 3);
  1469. X    tool_more(NULL);
  1470. X    return;
  1471. X    }
  1472. X    /* y must be positive (forward scrolling) so we're scrolling typed
  1473. X     * text or something like that (~p, ~?, etc...)
  1474. X     */
  1475. X    pw_copy(msg_win, 0, 0,
  1476. X    msg_rect.r_width, msg_rect.r_height - y,
  1477. X    PIX_SRC, msg_win, 0, y);
  1478. X    pw_writebackground(msg_win, 0, msg_rect.r_height - y,
  1479. X    msg_rect.r_width, y, PIX_CLR);
  1480. X    txt.y -= y;
  1481. X}
  1482. X#endif SUNTOOL
  1483. X
  1484. X#ifdef CURSES
  1485. Xclr_bot_line()
  1486. X{
  1487. X    print("");
  1488. X}
  1489. X#endif CURSES
  1490. END_OF_FILE
  1491. if test 4092 -ne `wc -c <'print.c'`; then
  1492.     echo shar: \"'print.c'\" unpacked with wrong size!
  1493. fi
  1494. # end of 'print.c'
  1495. fi
  1496. if test -f 'strings.h' -a "${1}" != "-c" ; then 
  1497.   echo shar: Will not clobber existing file \"'strings.h'\"
  1498. else
  1499. echo shar: Extracting \"'strings.h'\" \(473 characters\)
  1500. sed "s/^X//" >'strings.h' <<'END_OF_FILE'
  1501. X/* @(#)strings.h    (c) copyright 9/3/86 (Dan Heller) */
  1502. X
  1503. X/* External function definitions for routines described in string(3).  */
  1504. Xchar    *strcat(), *strncat(), *strcpy(), *strncpy();
  1505. Xint    strcmp(), strncmp(), strlen();
  1506. X
  1507. X#ifdef SYSV
  1508. X#define sprintf Sprintf
  1509. X#define    index    strchr
  1510. X#define    rindex    strrchr
  1511. X#endif /* SYSV */
  1512. X
  1513. Xchar 
  1514. X    *sprintf(),        /* Sprintf for sysv -- see end of misc.c */
  1515. X    *any(),         /* return first char in str2 that exists in str1 */
  1516. X    *index(), *rindex();
  1517. END_OF_FILE
  1518. if test 473 -ne `wc -c <'strings.h'`; then
  1519.     echo shar: \"'strings.h'\" unpacked with wrong size!
  1520. fi
  1521. # end of 'strings.h'
  1522. fi
  1523. if test -f 'tool.c' -a "${1}" != "-c" ; then 
  1524.   echo shar: Will not clobber existing file \"'tool.c'\"
  1525. else
  1526. echo shar: Extracting \"'tool.c'\" \(4280 characters\)
  1527. sed "s/^X//" >'tool.c' <<'END_OF_FILE'
  1528. X/* @(#)tool.c    (c) copyright    10/15/86 (Dan Heller) */
  1529. X
  1530. X/* tool.c --make the mailtool windows, panels, etc... */
  1531. X#include "mush.h"
  1532. X
  1533. Xmake_tool(argc, argv)
  1534. Xchar **argv;
  1535. X{
  1536. X    struct stat rootbuf, tmpbuf;
  1537. X    struct inputmask im;
  1538. X    register unsigned i;
  1539. X    char **args = DUBL_NULL, **choice_args, **button_args, *p;
  1540. X    char buf1[WIN_NAMESIZE], buf2[WIN_NAMESIZE];
  1541. X
  1542. X    getfonts();
  1543. X    mail_icon.ic_font = fonts[DEFAULT];
  1544. X
  1545. X    if (p = do_set(set_options, "screen_win"))
  1546. X    screen = atoi(p);
  1547. X    else
  1548. X    screen = 6;
  1549. X
  1550. X    time_out = TIME_OUT;
  1551. X    /* where to place text on mail icon -- how many messages there are */
  1552. X    rect_construct(&mail_icon.ic_textrect,
  1553. X    l_width(DEFAULT), 58-l_height(DEFAULT),
  1554. X    3*l_width(DEFAULT), l_height(DEFAULT));
  1555. X
  1556. X    tool_parse_all(&argc, argv, &args, prog_name);
  1557. X
  1558. X    if (!(tool = tool_make(
  1559. X    WIN_ICON,         &mail_icon,
  1560. X    WIN_HEIGHT,         700,
  1561. X    WIN_WIDTH,         650,
  1562. X    WIN_BOUNDARY_MGR,     1,
  1563. X    WIN_ATTR_LIST,         args,
  1564. X    NULL)))
  1565. X    perror(prog_name), cleanup(0);
  1566. X    tool_free_attribute_list(args);
  1567. X
  1568. X    choice_args = panel_make_list(
  1569. X    PANEL_MENU_TITLE_FONT, fonts[LARGE],
  1570. X    PANEL_DISPLAY_LEVEL, PANEL_NONE,
  1571. X    PANEL_SHOW_MENU, TRUE,
  1572. X    PANEL_SHOW_MENU_MARK, FALSE,
  1573. X    0);
  1574. X
  1575. X    button_args = panel_make_list(
  1576. X    PANEL_FEEDBACK, PANEL_INVERTED,
  1577. X    PANEL_SHOW_MENU, FALSE,
  1578. X    0);
  1579. X
  1580. X    make_hdr_panel(choice_args, button_args);
  1581. X
  1582. X    if (!(hdr_sw = gfxsw_createtoolsubwindow(tool, "hdr_sw",
  1583. X    TOOL_SWEXTENDTOEDGE, 10+ screen*l_height(DEFAULT), (char **)0)))
  1584. X    perror("hdr_sw"), cleanup(0);
  1585. X    gfxsw_getretained((struct gfxsubwindow *)hdr_sw->ts_data);
  1586. X    hdr_win = ((struct gfxsubwindow *)(hdr_sw->ts_data))->gfx_pixwin;
  1587. X
  1588. X    input_imnull(&im);
  1589. X    win_setinputcodebit(&im, LOC_STILL);
  1590. X    win_setinputcodebit(&im, LOC_MOVE);
  1591. X    win_setinputcodebit(&im, LOC_WINENTER);
  1592. X    for (i = VKEY_FIRSTFUNC; i <= VKEY_LASTFUNC; i++)
  1593. X    win_setinputcodebit(&im, i);
  1594. X    win_setinputmask(hdr_sw->ts_windowfd, &im, &im,
  1595. X                   win_fdtonumber(hdr_panel_sw->ts_windowfd)); 
  1596. X    hdr_sw->ts_io.tio_selected = hdr_io;
  1597. X    hdr_sw->ts_io.tio_handlesigwinch = hdrwin_handlesigwinch;
  1598. X
  1599. X    make_main_panel(choice_args, button_args);
  1600. X    xfree(choice_args), xfree(button_args);
  1601. X
  1602. X    if (!(print_sw = gfxsw_createtoolsubwindow(tool, "print_sw",
  1603. X    TOOL_SWEXTENDTOEDGE, l_height(LARGE) + 10, (char **)0)))
  1604. X    perror("print_sw"), cleanup(0);
  1605. X    print_win = ((struct gfxsubwindow *)(print_sw->ts_data))->gfx_pixwin;
  1606. X    print_sw->ts_io.tio_handlesigwinch = print_sigwinch;
  1607. X
  1608. X    /* text subwindow */
  1609. X    if (!(msg_sw = gfxsw_createtoolsubwindow(tool, "msg_sw",
  1610. X    TOOL_SWEXTENDTOEDGE, TOOL_SWEXTENDTOEDGE, (char **)0)))
  1611. X    perror("msg_sw"), cleanup(0);
  1612. X    gfxsw_getretained((struct gfxsubwindow *)msg_sw->ts_data);
  1613. X    msg_win = ((struct gfxsubwindow *)(msg_sw->ts_data))->gfx_pixwin;
  1614. X
  1615. X    /* everything we want the text window to pay attention to */
  1616. X    input_imnull(&im);
  1617. X    im.im_flags = IM_ASCII;
  1618. X    im.im_flags &= ~IM_ANSI;
  1619. X    for (i = VKEY_FIRSTFUNC; i <= VKEY_LASTFUNC; i++)
  1620. X    win_setinputcodebit(&im, i);
  1621. X    win_setinputmask(msg_sw->ts_windowfd, &im, &im, WIN_NULLLINK);
  1622. X    msg_sw->ts_io.tio_selected = msg_io;
  1623. X    msg_sw->ts_io.tio_handlesigwinch = msgwin_handlesigwinch;
  1624. X
  1625. X    /* tty subwindow */
  1626. X    if (!(tty_sw = ttytlsw_createtoolsubwindow(tool, "tty_sw",
  1627. X    TOOL_SWEXTENDTOEDGE, 0, (char **)0)))
  1628. X    perror("tty_sw"), cleanup(0);
  1629. X    ttysw_handlesigwinch(tty_sw);
  1630. X    win_setcursor(tty_sw->ts_windowfd, &write_cursor);
  1631. X
  1632. X    (void) sprintf(blank, "%128c", ' ');
  1633. X    (void) signal(SIGWINCH, sigwinchcatcher);
  1634. X    (void) signal(SIGTERM, sigtermcatcher);
  1635. X    (void) signal(SIGCHLD, sigchldcatcher);
  1636. X    pw_writebackground(hdr_win, 0,0, hdr_rect.r_width, hdr_rect.r_height,
  1637. X               PIX_CLR);
  1638. X    if (ioctl(0, TIOCGETC, &tchars))
  1639. X    perror("gtty failed"), cleanup(0);
  1640. X    win_numbertoname (0, buf1);
  1641. X    if ((rootfd = open(buf1, 0)) == -1)
  1642. X    error("can't open %s", buf1), cleanup(0);
  1643. X    if (fstat(rootfd, &rootbuf))
  1644. X    error("can't stat %s", buf1), cleanup(0);
  1645. X    for (parentfd = 3; parentfd < rootfd; parentfd++)
  1646. X    if (fstat(parentfd, &tmpbuf))
  1647. X        error("Can't stat fd-%d", parentfd);
  1648. X    else if (tmpbuf.st_ino == rootbuf.st_ino) {
  1649. X        (void) close(rootfd);
  1650. X        rootfd = parentfd;
  1651. X        break;
  1652. X    }
  1653. X    istool = 2;
  1654. X    (void) do_version();
  1655. X    lock_cursors();
  1656. X    tool_install(tool);
  1657. X    tool_display(tool);
  1658. X    do_clear();
  1659. X}
  1660. END_OF_FILE
  1661. if test 4280 -ne `wc -c <'tool.c'`; then
  1662.     echo shar: \"'tool.c'\" unpacked with wrong size!
  1663. fi
  1664. # end of 'tool.c'
  1665. fi
  1666. if test -f 'up.arrow.pr' -a "${1}" != "-c" ; then 
  1667.   echo shar: Will not clobber existing file \"'up.arrow.pr'\"
  1668. else
  1669. echo shar: Extracting \"'up.arrow.pr'\" \(243 characters\)
  1670. sed "s/^X//" >'up.arrow.pr' <<'END_OF_FILE'
  1671. X/* "@(#)up.arrow.pr    2.2    9/3/86 (Dan Heller)"; */
  1672. X
  1673. X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  1674. X */
  1675. X    0xFFFF,0x8001,0xA439,0xA425,0xA439,0x9821,0x8181,0x83C1,
  1676. X    0x87E1,0x8FF1,0x9FF9,0xBFFD,0xBFFD,0xBFFD,0x8001,0xFFFF
  1677. END_OF_FILE
  1678. if test 243 -ne `wc -c <'up.arrow.pr'`; then
  1679.     echo shar: \"'up.arrow.pr'\" unpacked with wrong size!
  1680. fi
  1681. # end of 'up.arrow.pr'
  1682. fi
  1683. if test -f 'write.pr' -a "${1}" != "-c" ; then 
  1684.   echo shar: Will not clobber existing file \"'write.pr'\"
  1685. else
  1686. echo shar: Extracting \"'write.pr'\" \(244 characters\)
  1687. sed "s/^X//" >'write.pr' <<'END_OF_FILE'
  1688. X/* "@(#)write.cursor    2.2    9/3/86 (Dan Heller)"; */
  1689. X
  1690. X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  1691. X */
  1692. X    0x0018,0x002C,0x0056,0x00A4,0x0148,0x0290,0x0520,0x0A40,
  1693. X    0x1080,0x2100,0x4200,0xE400,0xE800,0xF000,0xE000,0x0000
  1694. END_OF_FILE
  1695. if test 244 -ne `wc -c <'write.pr'`; then
  1696.     echo shar: \"'write.pr'\" unpacked with wrong size!
  1697. fi
  1698. # end of 'write.pr'
  1699. fi
  1700. echo shar: End of archive 1 \(of 12\).
  1701. cp /dev/null ark1isdone
  1702. MISSING=""
  1703. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  1704.     if test ! -f ark${I}isdone ; then
  1705.     MISSING="${MISSING} ${I}"
  1706.     fi
  1707. done
  1708. if test "${MISSING}" = "" ; then
  1709.     echo You have unpacked all 12 archives.
  1710.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1711. else
  1712.     echo You still need to unpack the following archives:
  1713.     echo "        " ${MISSING}
  1714. fi
  1715. ##  End of shell archive.
  1716. exit 0
  1717.